package com.xiaoliang.dao.impl;

import com.xiaoliang.dao.UserDao;
import com.xiaoliang.entry.User;
import com.xiaoliang.tools.JDBCUtils.JDBCUtils;

/**
 * @author XIAOLIANG
 * @ClassName UserDaoImpl.java
 * @Description TODO
 * @createTime 2021年02月25日 18:46:00
 */
public class UserDaoImpl implements UserDao {
	@Override
	public int insert(User user) {
		return JDBCUtils.update("insert into user values(null,?,?)",user.getUsername(),user.getPassword());
	}

	@Override
	public boolean selectIsExist(User user) {

		User user1 = JDBCUtils.queryOne("select * from user where username = ? and password = ?", User.class, user.getUsername(), user.getPassword());

		return user1!=null;

	}
}
